import java.sql.*;

public class Update {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {


        Class.forName("com.mysql.cj.jdbc.Driver");//加载JDBC
        String url = "jdbc:mysql://localhost:3306/people_data?serverTimezone=GMT%2B8";
        String username = "lx";
        String password = "lx061900..";

        Connection connection = DriverManager.getConnection(url, username, password);

        Statement statement = connection.createStatement();


        String sql1 = "UPDATE people SET username = '' WHERE userid=5";
        statement.executeUpdate(sql1);
        String sql = "SELECT * FROM people";
        ResultSet resultSet = statement.executeQuery(sql);
        while(resultSet.next()){
            System.out.println("userid:"+resultSet.getObject("userid"));
            System.out.println("username:"+resultSet.getObject("username"));
            System.out.println("password:"+resultSet.getObject("password"));
            System.out.println("email:"+resultSet.getObject("email"));
            System.out.println("grade:"+resultSet.getObject("grade"));
            System.out.println("*******************************************");

        }
        statement.close();
        connection.close();
        resultSet.close();





    }
}
